<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.jieSuan.zhiFuDanGuanLi"/>   <spring:message code="message.jieSuan.zhiFuDanMingXi"/><spring:message code="message.jqGrid.cz.xiangQing"/>   <spring:message code="message.jqGrid.cz.xiangQing"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <style type="text/css">
        div.group-info {
            margin-top: 10px !important;
            margin-bottom: 0px !important;
        }
        input.innerInput {
            width: 98%;
        }
        .text-left{
        color:#949494;
        }
    </style>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.jieSuan.jieSuanDan"/><spring:message code="message.jqGrid.cz.xiangQing"/></h1>
       <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.jieSuan.zhiFuDanGuanLi"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.button.look"/></a></li>
        </ol>
     </section>
     
     <section class="content" style="min-height:inherit;">
     <table class="infoBox">
      <tr>
        <td width="150px" class="infoBoxleft">
        <p style="color:#fff;font-size:20px;text-align:center;font-weight:600"><spring:message code="message.jieSuan.zhiFuDan"/><spring:message code="message.jqGrid.cz.xiangQing"/></p>
        </td>
        <td>
        	<form id="form" class="form-horizontal"  method="post">
            <input type="hidden" name=settlementId value="${settlement.settlementId}" />
                <div class="box-body" style="background:url('${ctx }/lib/img/infobg.png') no-repeat bottom right;">
                    <div class="form-group form-group-xs"  style="margin-top:5px;">
                    <label for="inputTextAlter1" class="col-sm-2 text-right"><spring:message code="message.jieSuan.jieSuanDan"/><spring:message code="message.yanZheng.bianMa"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div class="col-sm-3 text-left" >${settlement.settlementCode}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right"><spring:message code="message.jieSuan.jieSuanDan"/><spring:message code="message.listForm.mingCheng"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="orgName" class="col-sm-3 text-left">${settlement.settlementName}</div>
                    </div>
                    
                    <div class="form-group form-group-xs" style="margin-top:-10px">
                     <label for="inputTextAlter1" class="col-sm-2 text-right"><spring:message code="message.jieSuan.zongTiaoMuShu"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="outstandAmt" class="col-sm-3 text-left">${settlement.totalOrders}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right"><spring:message code="message.jieSuan.zongJinE"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="availableAmt" class="col-sm-3 text-left">${settlement.totalAmount}</div>
                    </div>
                    
                   <div class="form-group form-group-xs" style="margin-top:-10px;margin-bottom:-10px;">
                     <label for="inputTextAlter1" class="col-sm-2 text-right"><spring:message code="message.lable.remark"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="pendingAmt" class="col-sm-9 text-left">${settlement.remarks}</div>
                </div>
                </div>
             </form>
        </td>
      </tr>
      </table>
         

        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
        
                   <div class="form-group form-group-xs">
                        <label for="name"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <input class="form-control" type="text" id="drugName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" maxlength="100" />
                    </div>
                   
                   <div class="form-group form-group-xs">
                        <label for="name"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <input class="form-control" type="text" id="drugCode" placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" maxlength="100" />
                    </div>
                    
                    <div class="form-group form-group-xs">
                        <label for="name"><spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.listForm.mingCheng"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <input class="form-control" type="text" id="prodCompName" placeholder="<spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.listForm.mingCheng"/>" maxlength="200" />
                    </div>
                    
                   <button  id="selectWSJ"   type="button" onclick="gridSerch();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                    
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <div class=" box box-warning bottongroup">
            <a href="${ctx}/payment/toSetSettlementFirstDetailList.html?settlementId=${settlementId2}&paymentBillId=${payment.paymentBillId}" class="btn btn-default btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
        </div>
   </section> 
    
   <%@ include file="/WEB-INF/component/commonJS.jsp"%>
   <script type="text/javascript">
   
   //加载页面光标在名字框内，位于第一个
   $("#drugName").focus();
   
 //绑定回车    id="selectWSJ"  
   $('#drugName,#drugCode,#prodCompName').bind('keydown', function(event) {
       if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
           $('#selectWSJ').click();
       }
   }); 
   
         $(function() {
             
             jQuery("#gridlist").jqGrid({
            	 url: "${ctx}/payment/getSettlementDetailList.html",
                    mtype: "POST",
                    datatype: "json",
                    postData:{
                    	"paymentBillId":"${payment.paymentBillId}", 
                    	"settlementId":"${payment.settlementId}"
                    },
                    autowidth: true,
                    shrinkToFit: false,
                    height: 270,
                    colNames:[ 
                               '<spring:message code="message.jieSuan.zhiFuMingXi"/><spring:message code="message.lable.userType"/>',
                               '<spring:message code="message.model.peiSongQiYe"/>ID',
                               '<spring:message code="message.model.peiSongQiYe"/>',
                               '<spring:message code="message.listForm.yiLiaoJiGou"/>',
                               '<spring:message code="message.listForm.yaoPinBianMa"/>', 
                               '<spring:message code="message.listForm.tongYongMing"/>',
                               '<spring:message code="message.listForm.jiXing"/>',
                               '<spring:message code="message.listForm.guiGe"/>',
                               '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
                               '<spring:message code="message.listForm.baoZhuangDanWei"/>',
                               '<spring:message code="message.listForm.caiZhi"/>',
                               '<spring:message code="message.listForm.shengChanQiYe"/>',
                               '<spring:message code="message.jieSuan.caiGouJia"/>',
                               '<spring:message code="message.jieSuan.daoHuoShuLiang"/>'
                               ],
                    colModel:[
                        { name: 'bankAcctTransType', width:120,align:"center" ,sortable:false},   
                        { name: 'compId', width:160,hidden:true,align:"center" ,sortable:false},       
                        { name: 'compName', width:190,align:"left" ,sortable:false,
                            formatter:function(cellvalue, options, row){
                                return '<a href="javascript:showCompInfo(\''+ row.compId +'\');">'+cellvalue+'</a>';
                            }
                        },
                        { name: 'hospName', width:180,align:"left" ,sortable:false,
                            formatter:function(cellvalue, options, row){
                                return '<a href="javascript:showHospInfo(\''+ row.hospId +'\');">'+cellvalue+'</a>';
                            }
                        },      
                        { name: 'drugCode', width:100,align:"center" ,sortable:false,
                            formatter:function(cellvalue, options, row){
                                return '<a href="javascript:showDrugInfo(\''+ row.drugId +'\');">'+cellvalue+'</a>';
                            }
                        },
                        { name: 'drugName', width:140, align:"left",sortable:false},
                        { name: 'formName', width:80, align:"center",sortable:false},
                        { name: 'specName', width:80, align:"left",sortable:false},
                        { name: 'factor', width:80, align:"center",sortable:false},
                        { name: 'unit', width:40, align:"center",sortable:false},
                        { name: 'materialName', width:80, align:"center",sortable:false},
                        { name: 'prodCompName', width:180, align:"left",sortable:false,
                            formatter:function(cellvalue, options, row){
                                return '<a href="javascript:showCompInfo(\''+ row.prodCompId +'\');">'+cellvalue+'</a>';
                            }
                        },
                        { name: 'proPrice', width:80, align:"right",sortable:false,
                     	   formatter:function(cellvalue, options, row){
                               return formatAmount(cellvalue, options, row);
                           }},
                        { name: 'recpCount', width:60, align:"center",sortable:false}
                        
                    ],
                     rowNum: 20,
                     rowList: [10, 20, 50, 100],
                     rownumbers: true,
                     pager: "#gridpage",
                     viewrecords: true,
                     multiselect: false, 
                     caption: "<spring:message code="message.jieSuan.zhiFuDanMingXi"/><spring:message code="message.jqGrid.cz.xiangQing"/><spring:message code="message.listForm.lieBiao"/>",
                   //序号宽度自动变化
                     gridComplete:function(){
                         //序号列宽度自适应（参数为jqgridID）
                         autoRNWidth("gridlist");
                         //数据只有一条时默认选中（参数为jqgridID）
                         selectByOneData("gridlist");
                     },
                     jsonReader: {
                         repeatitems: false,
                         id: "ids"
                     }
                });
                
                $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
                
                $(window).trigger("resize");
                
            });
               
           //查询
           function gridSerch() {
               var drugCode = $.trim($("#drugCode").val());
               var drugName = $.trim($("#drugName").val());
               var prodCompName = $.trim($("#prodCompName").val());
               $("#gridlist").jqGrid('setGridParam',{  
                   datatype:'json',
                   postData:{
                       "drugCode":drugCode,
                       "drugName":drugName,
                       "prodCompName":prodCompName
                   },
                   page:1
               }).trigger("reloadGrid"); //重新载入  
           }
           
           
           //医疗机构信息弹窗
           function showHospInfo(hospId) {
               $.HN.dialog.open({
                   "id": "showHospInfo", 
                   "title": "<spring:message code="message.listForm.yiLiaoJiGou"/><spring:message code="message.listForm.xinXi"/>", 
                   "url": "${ctx}/stdHospInfo/hospInfoDetail.html?hospId="+hospId,
                   "data": {}, 
                   "width": 800, 
                   "height": 400, 
                   "closefunc":function() {
                       
                   }
               });
           }
           
           //药品信息弹窗
           function showDrugInfo(drugId) {
               $.HN.dialog.open({
                   "id": "showDrugInfo", 
                   "title": "<spring:message code="message.listForm.yaoPin"/><spring:message code="message.listForm.xinXi"/>", 
                   "url": "${ctx}/stdDrug/drugInfoDetail.html?drugId="+drugId,
                   "data": {}, 
                   "width": 800, 
                   "height": 400, 
                   "closefunc":function() {
                       
                   }
               });
           }
           
           //生产企业信息弹窗
           function showCompInfo(prodCompId) {
               $.HN.dialog.open({
                   "id": "showCompInfo", 
                   "title": "<spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.listForm.xinXi"/>", 
                   "url": "${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+prodCompId,
                   "data": {}, 
                   "width": 800, 
                   "height": 400, 
                   "closefunc":function() {
                       
                   }
               });
           }
           
    </script>
</body>
</html>